import * as userApi from '@/api/user'
export default {
    data() {
       return {
            share:{
               title: '团团收',
							 path: '',
               imageUrl:'https://www.tuantuanshou.com/default.png',
            }
       }
    },
		
    onShareAppMessage(res) { //发送给朋友
				const promise = new Promise(resolve => {
					if(!uni.getStorageSync('userInfo')){
							uni.showToast({
								title:"您还未登录，分享不会让下级加入",
								icon:"none"
							})
					}
					let share = uni.getStorageSync('shareMp')
					let pages = getCurrentPages();
					let currentPage = pages[pages.length-1];
					let url = currentPage.route;
					setTimeout(() => {
						resolve({
							title: share.title,
							path:url + '?yq=' +uni.getStorageSync('userInfo').user_id,
							imageUrl:share.image
						})
					}, 1000)
				})
				return {
					title: '自定义转发标题',
					path: '/pages/index/index',
					promise 
				}
    },
    onShareTimeline(res) {//分享到朋友圈
				let share = uni.getStorageSync('shareMp')
				const promise = new Promise(resolve => {
					if(!uni.getStorageSync('userInfo')){
							uni.showToast({
								title:"您还未登录，分享不会让下级加入",
								icon:"none"
							})
					}
					let share = uni.getStorageSync('shareMp')
					let pages = getCurrentPages();
					let currentPage = pages[pages.length-1];
					let url = currentPage.route;
					console.log(uni.getStorageSync('userInfo').user_id)
					setTimeout(() => {
						resolve({
							// title: share.title,
							// query:'yq=44',
							// // path:url + '?yq=' +uni.getStorageSync('userInfo').user_id,
							// imageUrl:share.image,
							
						})
					}, 1000)
				})
				return {
					query:'yq='+uni.getStorageSync('userInfo').user_id,
					title: share.title,
					imageUrl:share.image,
				}
    },
}